Web API Phrases
Web API Configures the Yadda parser with phrases that support operations on HTTP APIs
Item Index
Methods
- Disable HTTP GZIP compression
- Disable HTTP keep alive
- Enable HTTP GZIP compression
- Enable HTTP keep alive
- Extract variable from a JSON response
- Extract variable from an HTTP header
- Send HTTP DELETE request
- Send HTTP GET request
- Send HTTP HEAD request
- Send HTTP PATCH request
- Send HTTP POST request
- Send HTTP PUT request
- Send request for HTTP OPTIONS
- Set access_token
- Set HTTP Request Header
- Set HTTP Request Header
- Set HTTP Request Parameter
- Set HTTP response
- Set HTTP response
- Set HTTP response
- Set HTTP response
- Set HTTP response
- Set HTTP timeout
- Set named cookies
- Use Client Certificate
- Use Client Credentials to authenticate
- Use Client Credentials to authenticate as default agent
Methods
Disable HTTP GZIP compression
()
Disable HTTP GZIP compression
I disable gzip
Example:
GIVEN I disable gzip
Disable HTTP keep alive
()
Disable HTTP keep-alive
I disable keep-alive
Example:
GIVEN I disable keep-alive
Enable HTTP GZIP compression
()
Enable HTTP GZIP compression
I enable gzip
Example:
GIVEN I enable gzip
Enable HTTP keep alive
()
Enable HTTP keep-alive
I enable keep-alive
Example:
GIVEN I enable keep-alive
Extract variable from a JSON response
-
path -
name
Extra a value from the (JSON) body and store as a scoped variable
I store body path $path as $name
Parameters:
-
pathString- JSON Path to extract variable
-
nameString- scoped variable to store result
Example:
I store body path $.access_token as access-token
Extract variable from an HTTP header
-
header -
name
Extract avalue from HTTP header and store as a scoped variable
I store header $header as $name
Parameters:
-
headerString- name of header to extract
-
nameString- scoped variable to store result
Example:
I store header ApiKey as client_id
Send HTTP DELETE request
-
resource
Issue an HTTP DELETE request to default target or an absolute URL. The @target annotation is used to select a target
I DELETE $resource
Parameters:
-
resourceString- target resource path or full URL
Example:
I DELETE /
I DELETE http://example.com
Send HTTP GET request
-
resource
Issue an HTTP GET request to default target or an absolute URL. The @target annotation is used to select a target
I GET $resource
Parameters:
-
resourceString- target resource path or full URL
Example:
I GET /
I GET http://example.com
Send HTTP HEAD request
-
resource
Issue an HTTP HEAD request to default target or an absolute URL. The @target annotation is used to select a target
I request HEAD for $resource
Parameters:
-
resourceString- target resource path or full URL
Example:
I request HEAD for /
I request HEAD for http://example.com
Send HTTP PATCH request
-
resource
Issue an HTTP PATCH request to default target or an absolute URL. The @target annotation is used to select a target
I PATCH $resource
Parameters:
-
resourceString- target resource path or full URL
Example:
I PATCH /
I PATCH http://example.com
Send HTTP POST request
-
resource
Issue an HTTP POST request to default target or an absolute URL. The @target annotation is used to select a target
I POST $resource
Parameters:
-
resourceString- target resource path or full URL
Example:
I POST /
I POST http://example.com
Send HTTP PUT request
-
resource
Issue an HTTP PUT request to default target or an absolute URL. The @target annotation is used to select a target
I PUT $resource
Parameters:
-
resourceString- target resource path or full URL
Example:
I PUT /
I PUT http://example.com
Send request for HTTP OPTIONS
-
resource
Issue an HTTP POST request to default target or an absolute URL. The @target annotation is used to select a target
I request OPTIONS for $resource
Parameters:
-
resourceString- target resource path or full URL
Example:
I request OPTIONS for /
I request OPTIONS for http://example.com
Set access_token
-
token
Set an OAUTH access_token both as scoped variable for use in subsequent requests. The $path parameter is a JSON path used to access the (non-standard) access_token from the current HTTP response.
I store body path $path as access token
Parameters:
-
tokenString- valid oauth access token
Example:
I store body path $.access_token as access token
Set HTTP Request Header
-
name -
varname
Set an HTTP Header from a variable
I set $header header from $varname
Parameters:
-
nameString- header name
-
varnameString- a scoped variable name
Example:
I set test = 123
I set header x-my-header from test
Set HTTP Request Header
-
name -
value
Set an HTTP Header to a value
I set $header header to $value
I set header $header = $value
Parameters:
-
nameString- header name
-
valueString- header value
Example:
I set header Accept to application/json
Set HTTP Request Parameter
-
name -
value
Add an HTTP Query Parameter to the Request
I set parameter $key to $value
I set $key parameter to $value
I set $key param to $value
I set param $key to $value
Parameters:
-
nameString- query parameter name
-
valueString- query parameter value
Example:
I set parameter api_key to ABCD1234
Set HTTP response
-
payload
Set HTTP response to payload. Objects are sent as JSON, everything else as BODY text.
I set body to $payload
Parameters:
-
payloadString- JSON or text payload
Example:
I set body to hello world
Set HTTP response
-
payload
Set HTTP response to CSV payload.
I set body to CSV:
------------
$CSV
------------
I send CSV:
------------
$CSV
------------
Parameters:
-
payloadString- JSON or text payload
Example:
I set body to CSV:
------------
what, who
hello, world
------------
Set HTTP response
-
payload
Set HTTP response to JSON payload.
I set body to JSON:
------------
$JSON
------------
I send JSON:
------------
$JSON
------------
Parameters:
-
payloadString- JSON or text payload
Example:
I set body to JSON:
------------
{ "what": "hello", "who": "world" }
------------
Set HTTP response
-
payload
Set HTTP response to JSON payload.
I set body to JSON:
------------
$JSON
------------
I send JSON:
------------
$JSON
------------
Parameters:
-
payloadString- JSON or text payload
Example:
I set body to JSON:
------------
{ "what": "hello", "who": "world" }
------------
Set HTTP response
-
text
Set HTTP response to raw (text) payload.
I set body to:
------------
$TEXT
------------
I send:
------------
$TEXT
------------
Parameters:
-
textStringpayload
Example:
I set body to:
------------
Hello World
------------
Set HTTP timeout
-
timeout
Set a named HTTP timeout to a time in milliseconds
I set request timeout to $time
Parameters:
-
timeoutString- duration in milliseconds
Example:
GIVEN I set request timeout to 3000
Use Client Certificate
-
cert
Add a client certificate to an HTTP request. The certificate itself is defined in the config.json file.
I use a $CERT client certificate
I use an $CERT client certificate
Parameters:
-
certString- certificate name
Example:
I use a valid client certificate
Use Client Credentials to authenticate
-
agent
Use OAUTH flow to authenticate using a named agent
I use OAuth2 credentials as $agent
I use oauth credentials as $agent
I use client-credentials as $agent
Parameters:
-
agentString- named agent
Example:
I use client-credentials as default
Use Client Credentials to authenticate as default agent
()
Use OAUTH flow to authenticate using default agent
I use OAuth2
I use oauth
Example:
I use oauth
